import 'package:flutter/material.dart';

class AppLocalizations {
  AppLocalizations(this.locale);

  final Locale locale;

  static AppLocalizations of(BuildContext context) {
    return Localizations.of<AppLocalizations>(context, AppLocalizations);
  }

  static    Map<String,  Map<String, String>> _localizedValues = {
    'en': {
      'title': 'Hello World1',
      'pageA': 'page A ',

      'textField': 'textField ',
    },
    'vi': {
      'title': 'Xin chào',
      'pageA': 'Xin chào111',

      'textField': 'Xin chào111 ',
    },
    'zh': {
      'title': '你好',
      'pageA': '第一页',

      'textField': '产品编号',
    }
  };

  //  AppLocalizations.of(context).title 显示文字
  String get title {
    return _localizedValues[locale.languageCode]['title'];
  }

  String get pageA {
    return _localizedValues[locale.languageCode]['pageA'];
  }

  String get  textField {
    return _localizedValues[locale.languageCode]['textField'];
  }
}